home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / esc / JTreeTable$ListToTreeSelectionModelWrapper.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  1.9 KB  |  64 lines

  1. package com.extensibility.esc;
  2.  
  3. import javax.swing.ListSelectionModel;
  4. import javax.swing.event.ListSelectionListener;
  5. import javax.swing.tree.DefaultTreeSelectionModel;
  6. import javax.swing.tree.TreePath;
  7.  
  8. class JTreeTable$ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel {
  9.    // $FF: synthetic field
  10.    final JTreeTable this$0;
  11.    protected boolean updatingListSelectionModel;
  12.  
  13.    public JTreeTable$ListToTreeSelectionModelWrapper(JTreeTable var1) {
  14.       this.this$0 = var1;
  15.       this.getListSelectionModel().addListSelectionListener(this.createListSelectionListener());
  16.    }
  17.  
  18.    ListSelectionModel getListSelectionModel() {
  19.       return super.listSelectionModel;
  20.    }
  21.  
  22.    public void resetRowSelection() {
  23.       if (!this.updatingListSelectionModel) {
  24.          this.updatingListSelectionModel = true;
  25.  
  26.          try {
  27.             super.resetRowSelection();
  28.          } finally {
  29.             this.updatingListSelectionModel = false;
  30.          }
  31.       }
  32.  
  33.    }
  34.  
  35.    protected ListSelectionListener createListSelectionListener() {
  36.       return new JTreeTable.2(this);
  37.    }
  38.  
  39.    protected void updateSelectedPathsFromSelectedRows() {
  40.       if (!this.updatingListSelectionModel) {
  41.          this.updatingListSelectionModel = true;
  42.  
  43.          try {
  44.             int var1 = super.listSelectionModel.getMinSelectionIndex();
  45.             int var2 = super.listSelectionModel.getMaxSelectionIndex();
  46.             ((DefaultTreeSelectionModel)this).clearSelection();
  47.             if (var1 != -1 && var2 != -1) {
  48.                for(int var3 = var1; var3 <= var2; ++var3) {
  49.                   if (super.listSelectionModel.isSelectedIndex(var3)) {
  50.                      TreePath var4 = this.this$0.tree.getPathForRow(var3);
  51.                      if (var4 != null) {
  52.                         ((DefaultTreeSelectionModel)this).addSelectionPath(var4);
  53.                      }
  54.                   }
  55.                }
  56.             }
  57.          } finally {
  58.             this.updatingListSelectionModel = false;
  59.          }
  60.       }
  61.  
  62.    }
  63. }
  64.